#include<bits/stdc++.h>
using namespace std; 
int main()
{
  string s;
  cin>>s;
  unordered_map<int,int> hash;
  for(auto& ch:s)
  hash[ch-'a']++;
  int maxcount=0;
  char maxval;
  for(int i='a';i<26;++i)
  {
    if(hash[i]>maxcount)
    {
      maxcount=hash[i];
    }
    else if(hash[i]==maxcount)
    {
      if(maxval<i)
      {
        maxval=i;
      }
    }
  }
  cout<<maxval<<endl<<maxcount;
  return 0;
}
